#include<bits/stdc++.h>
using namespace std;
#define M 100005
int n,tp=1,ans=0;
int a[M];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++) scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++){
        if(a[i]<=a[tp]){
            ans++;
            continue;
        }
        tp++;
    }
    cout<<ans;
    return 0;
}
